import { http } from "@/utils/http";
import baseUrlProxy from "@/api/baseUrlProxy";
export type VppStorageItem = {
  id: number;
  vppUserId: number;
  storSeqNo: number;
  longitude: number;
  latitude: number;
  maxLoad: number;
  maxOutput: number;
  maxAdjustStep: number;
  normalAdjustSpeed: number;
  maxUpSpeed: number;
  maxDownSpeed: number;
  socUpperLimit: number;
  socLowerLimit: number;
  unitChargeCost: number;
  unitDischargeCost: number;
  chargeRatio: number;
  dischargeRatio: number;
  selfDischargeRatio: number;
  selfUseRatio: number;
  minChargeTime: number;
  minDischargeTime: number;
  status: number;
  storStatus: number;
  totalRevenue: number;
  shareRevenue: number;
  totalP: number;
  totalQ: number;
  name: string;
  storMaker: string;
  storEmsMaker: string;
  storEmsIpadd: string;
  longitudeAndLatitude: string;
  initOnlineTime: string;
  onlineTime: string;
  offlineTime: string;
  pKey: string;
  qKey: string;
  socKey: string;
  storStatusKey: string;
  contactName: string;
  contactTel: string;
  createBy: string;
  createTime: string;
  updateBy: string;
  updateTime: string;
};
export type ResultStorageList = {
  content: VppStorageItem[];
  totalElements: number;
};

export const getVppStorageList = (data?: object) => {
  return http.request<ResultStorageList>(
    "get",
    baseUrlProxy + "/api/storage_info",
    {
      params: data
    }
  );
};

export const getStoreListAll = (data?: object) => {
  return http.request<any>(
    "get",
    baseUrlProxy + "/api/storage_info/query_all",
    {
      params: data
    }
  );
};
export const getVppStorageDetail = id => {
  return http.request<VppTerminalItem>(
    "get",
    baseUrlProxy + "/api/storage_info/id/" + id
  );
};
export const addVppStorageList = (data?: object) => {
  return http.request<any>("post", baseUrlProxy + "/api/storage_info", {
    data: data
  });
};

export const editVppStorageList = (data?: object) => {
  return http.request<any>("put", baseUrlProxy + "/api/storage_info", {
    data: data
  });
};

export const delVppStorageList = (data?: object) => {
  return http.request<any>("delete", baseUrlProxy + "/api/storage_info", {
    data: data
  });
};

export const exportVppStorageList = (data?: object) => {
  return http.request<any>(
    "get",
    baseUrlProxy + "/api/storage_info/download",
    { params: data },
    { responseType: "blob" }
  );
};
